package com.lingxu.module.homeIndex.controller;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.module.homeIndex.entity.ParamsDTO;
import com.lingxu.module.homeIndex.service.HomeIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @Title: HomeIndexController
 * @Package: com.lingxu.module.IndexHome.controller
 * @Author: ysj闫世杰
 * @Email: 1105324813@qq.com
 * @Date: Created in 2023/6/27 11:24
 * @Description: 首页统计
 * @Version: 1.0.0
 */

@RestController
@RequestMapping(value = "/homeIndex")
public class HomeIndexController {

    @Autowired
    private HomeIndexService homeIndexService;

    /**
     * @Author ysj闫世杰
     * @Description 在线人数统计
     * @Date 2023/6/27 11:33
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findOnlineCount")
    public Result findOnlineCount(){

        return homeIndexService.findOnlineCount();
    }

    /**
     * @Author ysj闫世杰
     * @Description 登录总次数
     * @Date 2023/6/27 15:36
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findLoginCount")
    public Result findLoginCount(){
        return homeIndexService.findLoginCount();
    }

    /**
     * @Author ysj闫世杰
     * @Description 模型类型分布
     * @Date 2023/6/27 16:40
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findModelTypeCount")
    public Result findModelTypeCount(@RequestBody ParamsDTO dto){
        return homeIndexService.findModelTypeCount(dto);
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询系统使用情况
     * @Date 2023/6/27 17:48
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findUserAndUseCount")
    public Result findUserAndUseCount(){
        return homeIndexService.findUserAndUseCount();
    }


    /**
     * @Author ysj闫世杰
     * @Description 查询模型排行·
     * @Date 2023/6/27 18:10
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/rankByBrowseTimes")
    public Result rankByBrowseTimes(){
        return homeIndexService.rankByBrowseTimes();
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询内存情况
     * @Date 2023/6/28 9:55
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findMemory")
    public Result findMemory(){
        return homeIndexService.findMemory();
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询CPU情况
     * @Date 2023/6/28 9:55
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findCPU")
    public Result findCPU(){
        return homeIndexService.findCPU();
    }

    /**
     * @Author ysj闫世杰
     * @Description 查询磁盘使用情况
     * @Date 2023/6/28 9:55
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findDisk")
    public Result findDisk(){
        return homeIndexService.findDisk();
    }


    /**
     * @Author ysj闫世杰
     * @Description 按使用量查询模型使用排行
     * @Date 2023/7/27 11:13
     * @Param:
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findModelUseLimit")
    public Result findModelUseLimit(@RequestBody ParamsDTO dto){
        return homeIndexService.findModelUseLimit(dto);
    }

    /**
     * @Author ysj闫世杰
     * @Description 按照问题量查询模型使用情况
     * @Date 2023/7/27 14:04
     * @Param: dto
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findModelProblemLimit")
    public Result findModelProblemLimit(@RequestBody ParamsDTO dto){
        return homeIndexService.findModelProblemLimit(dto);
    }


    /**
     * @Author ysj闫世杰
     * @Description 统计数据量
     * @Date 2023/7/27 16:53
     * @Param: dto
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findNumberData")
    public Result findNumberData(@RequestBody ParamsDTO dto){
        return homeIndexService.findNumberData(dto);
    }

    /**
     * @Author ysj闫世杰
     * @Description 部门分布
     * @Date 2023/7/28 9:05
     * @Param: dto
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findDeptCount")
    public Result findDeptCount(@RequestBody ParamsDTO dto){
        return homeIndexService.findDeptCount(dto);
    }

    /**
     * @Author ysj闫世杰
     * @Description 问题量统计
     * @Date 2023/7/28 9:17
     * @Param: dto
     * @return com.lingxu.base.common.api.vo.Result
     **/
    @RequestMapping(value = "/findModelProblemCount")
    public Result findModelProblemCount(@RequestBody ParamsDTO dto){
        return homeIndexService.findModelProblemCount(dto);
    }

    //区级用户登录情况
    @RequestMapping(value = "/findLoginCountByArea")
    public Result findLoginCountByArea(@RequestBody ParamsDTO dto){
        return homeIndexService.findLoginCountByArea(dto);
    }

    //部门登录情况
    @RequestMapping(value = "/findLoginByUserDept")
    public Result findLoginByUserDept(@RequestBody ParamsDTO dto){
        return homeIndexService.findLoginByUserDept(dto);
    }

    //地图数据量
    @RequestMapping(value = "/findDataCountMaps")
    public Result findDataCountMaps(@RequestBody ParamsDTO dto){
        return homeIndexService.findDataCountMaps(dto);
    }


    //导出Excel
    @RequestMapping(value = "/findModelDataExcel")
    public void findModelDataExcel(HttpServletResponse response){
        homeIndexService.findModelDataExcel(response);
    }

    @RequestMapping(value = "/findModelCloneLimit")
    public Result findModelCloneLimit(@RequestBody ParamsDTO dto){
        return homeIndexService.findModelCloneLimit(dto);
    }


    //地区模型使用量
    @RequestMapping(value = "/findAreaModelRun")
    public Result findAreaModelRun(@RequestBody ParamsDTO dto){
        return homeIndexService.findAreaModelRun(dto);
    }

    //查询模型分类下的成效反馈图
    @RequestMapping(value = "/findResultFeedBack")
    public Result findResultFeedBack(@RequestBody ParamsDTO dto){
        return homeIndexService.findResultFeedBack(dto);
    }

    //对应领域下包含成效反馈的模型信息
    @RequestMapping(value = "/findModel")
    public Result findModel(@RequestBody ParamsDTO dto){
        return homeIndexService.findModel(dto);
    }
}
